﻿using System;

namespace Oop02.Entity
{
    public class Person
    {
        public Person(string name,int age)
        {
            this.name = name;
            this.age = age;
        }

        public TShirt YF { get; set; }


        //字段
        string name;

        //属性
        public string Name
        {
            get { return name; }
            private set { name = value; }
        }

        int age;

        public int Age
        {
            get { return age; }
            private set { age = value; }
        }

        public void Intro()
        {
            Console.Write($"你好，我的名字叫{Name}，今年{Age}岁了，");
            if(YF == null)
            {
                Console.WriteLine("我没有穿衣服");
            }
            else
            {
                Console.WriteLine($"我穿{YF.Color}色的衣服");
            }
        }
    }


    public class TShirt
    {
        public string Color;
    }

    public class Shop
    {
        public void Try(Person p,TShirt t)
        {
            p.YF = t;
        }
    }
}
